package Algorithm;

public class BubbleSort {
    public static void BubbleSort(int[] array){
        for(int i=0;i<array.length-1;i++){
            for(int j=0;j<array.length-i-1;j++){
                if(array[j]>array[j+1]){
                    int tmp=array[j];
                    array[j]=array[j+1];
                    array[j+1]=tmp;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] array=new int[]{5,12,58,13,5,5648,721,516,8,787,4};
        BubbleSort(array);
        for(int element:array){
            System.out.print(element+" ");
        }
    }
}
